#!/usr/bin/env python
#-*- coding: utf-8 -*-
#
# BSD License
# Copyright (c) 2011, Wang Qiang
# All rights reserved.

"""
Generate random password.
"""

import string
from random import *


def generate_password(length):
    """
    Generate random password for given length.
    @param length: password length.
    """
    chars = string.ascii_letters + string.digits
    return "".join(choice(chars) for x in range(8))


if __name__ == "__main__":
    print generate_password(8)
